# !usr/bin/env python
# -*- coding:utf-8 _*-
"""
@Author:张广勤
@Web site: https://www.tunan.wang
@Github:www.github.com
 
@File:mybro04.py
@Time:2022/3/1 10:15

@Motto:不积跬步无以至千里，不积小流无以成江海！
"""
from mybro03 import Mybro

bro=Mybro('140700zgq','071726zgq001!')
# bro.switchquery()
zdlist=bro.getzdopts()
# zqlist=bro.getyjnopts(zdlist[23])
# print(zqlist)
# with open('zdmulu.csv','w',encoding='u8') as f:
#     #f.write(zd)
#     f.write('')
with open('zdmulu.csv','r',encoding='u8') as f:
    str1=f.read()
    #如果制度列表已存在,则不重写，不存在，则写入
    if str1.find(zdlist[0])==-1:
        i=1
        with open('zdmulu.csv', 'a', encoding='u8') as f:
            f.write('{')
            for zd in zdlist:
                if i<10:
                    f.write(f"'0{i}':'{zd}'")
                    f.write(',\n')
                else:
                    f.write(f"'{i}':'{zd}'")
                    f.write(',\n')
                i+=1
            f.write('}')
bro.closewindow()